<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 后台大布局 - Layui</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <!--<link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.css" rel="stylesheet">-->
    <i th:replace="~{common :: baseUrl}"></i>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <!--    头部-->
    <i th:replace="~{common :: head}"></i>
    <!--左侧-->
    <div class="layui-side-scroll">
        <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
        <ul class="layui-nav layui-nav-tree"  lay-filter="test">
            <!--            layui-nav-itemed  默认展开列表-->
            <li class="layui-nav-item">
                <a class="javascript:;" href="javascript:;"><i class="layui-icon layui-icon-rate-solid"></i>  菜品</a>
                <dl class="layui-nav-child">
                    <dd ><a th:href="@{/food/category/index}">• 菜品类别</a></dd>
                    <dd> <a th:href="@{/food/record/index}">• 菜品档案</a></dd>
                    <dd ><a th:href="@{/food/taste/index}">• 菜品口味</a></dd>
                    <dd><a th:href="@{/food/specification/index}">• 规格管理</a></dd>
                    <dd><a th:href="@{/food/material/index}">• 原料管理</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-template-1"></i>  库存</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/inventory/record/index}">• 菜品库存</a></dd>
                    <dd><a th:href="@{/inventory/material/index}">• 原料库存</a></dd>
                    <dd><a th:href="@{/purchase/orders/index}">• 采购单</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-form"></i>  报表</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/statement/orders/index}">• 订单报表</a></dd>
                    <dd><a th:href="@{/statement/record/index}">• 菜品流水</a></dd>
                    <dd><a th:href="@{/statement/recordValue/index}">• 菜品销量</a></dd>
                    <dd><a th:href="@{/statement/daily/index}">• 经营日报</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-rmb"></i>  促销</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/promotion/specialOffer/index}">• 特价折扣</a></dd>
                    <dd><a th:href="@{/promotion/mealHot/index}">• 套餐热卖</a></dd>
                    <dd><a th:href="@{/promotion/now/index}">• 当前促销</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item ">
                <a class="" href="javascript:;"><i class="layui-icon layui-icon-username"></i>  会员</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/member/category/index}">• 会员类别</a></dd>
                    <dd><a th:href="@{/member/set/index}">• 会员设置</a></dd>
                    <dd><a th:href="@{/member/manage/index}">• 会员管理</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item">
                <a href="javascript:;"><i class="layui-icon layui-icon-auz"></i>  门店</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/shop/assistant/index}">• 店员管理</a></dd>
                    <dd><a th:href="@{/shop/table/index}">• 桌位管理</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item layui-nav-itemed">
                <a href="javascript:;"><i class="layui-icon layui-icon-set-fill"></i>  设置</a>
                <dl class="layui-nav-child">
                    <dd><a th:href="@{/set/pay/index}">• 支付设置</a></dd>
                    <dd class="layui-this"><a th:href="@{/merchants/information/index}">• 商户资料</a></dd>
                </dl>
            </li>
        </ul>
    </div>



    <div class="layui-body layui-bg-gray">
        <!-- 内容主体区域 -->
        <div style="background-color:white; width: 100%;height: 5%;padding-left: 130px;padding-top: 5px" >
        <span class="layui-breadcrumb" >
            <a href="" style="font-size: 20px">设置</a>
             <a href="" style="font-size: 20px">商户资料</a>
        </span>
        </div>

        <!--正文-->
        <div style="background-color:white; width: 90%; height: 90%;margin-top: 1%;margin-left: 4%;padding-top: 1%;padding-left: 1%;padding-right: 1%">
            <form class="layui-form layui-form-pane" action="">
            <!--查询条件-->
            <div>

                    <div class="layui-form-item">
                        <div class="layui-inline">

                            <div class="layui-input-inline">
                                <select id="shopId" lay-verify="required" lay-search="">
                                    <option value="">店铺名称</option>
                                    <option th:each="l : ${merchantsInformationList}" th:value="${l.id}" th:text="${l.name}"
                                            th:selected='${l.id == 2019001}'

                                    >无</option>
                                </select>

                            </div>
                        </div>

                    </div>

            </div>
            <!--展示数据-->
            <div>


                <div class="layui-row">
                    <div class="layui-col-xs6">

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">商家ID</label>
                                <div class="layui-input-inline">
                                    <input type="text"  id="id"  readonly name="id" th:value="${merchantsInformation.id}" lay-verify="required"    class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">商家名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" id="tableName" th:value="${merchantsInformation.name}" lay-verify="required"  class="layui-input">
                                </div>
                            </div>
                        </div>





                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">所属行业</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="industryInvolved" id="industryInvolved" th:value="${merchantsInformation.industryInvolved}" lay-verify="required"  class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">城市</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="city" id="city" th:value="${merchantsInformation.city}" lay-verify="required"  class="layui-input">
                                </div>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">地址</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="address" id="address" th:value="${merchantsInformation.address}" lay-verify="required"  class="layui-input">
                                </div>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">联系电话</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="telephone" id="telephone" th:value="${merchantsInformation.telephone}" lay-verify="phone"  class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">联系人</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="principal" id="principal" th:value="${merchantsInformation.principal}" lay-verify="required"  class="layui-input">
                                </div>
                            </div>
                        </div>




                    </div>
                    <div class="layui-col-xs6">

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">营业执照</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload">

                                        <div class="layui-upload-list">
                                            <input hidden name="businessLicense" id="picPath1" th:value="${merchantsInformation.businessLicense}">
                                            <img width="75px" height="75px" class="layui-upload-img" name="showPic" id="showPic1" th:src="${merchantsInformation.businessLicense}">
                                            <p id="uploadText1"></p>
                                        </div>
                                        <button type="button" class="layui-btn" id="uploadPic1">上传图片</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">其他资质</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload">

                                        <div class="layui-upload-list">
                                            <input hidden name="otherQualifications" id="picPath2" th:value="${merchantsInformation.otherQualifications}">
                                            <img width="75px" height="75px" class="layui-upload-img" name="showPic" id="showPic2" th:src="${merchantsInformation.otherQualifications}">
                                            <p id="uploadText2"></p>
                                        </div>
                                        <button type="button" class="layui-btn" id="uploadPic2">上传图片</button>
                                    </div>
                                </div>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">客户商标</label>
                                <div class="layui-input-inline">
                                    <div class="layui-upload">

                                        <div class="layui-upload-list">
                                            <input hidden name="merchantsTrademark" id="picPath3" th:value="${merchantsInformation.merchantsTrademark}">
                                            <img width="75px" height="75px" class="layui-upload-img" name="showPic" id="showPic3" th:src="${merchantsInformation.merchantsTrademark}">
                                            <p id="uploadText3"></p>
                                        </div>
                                        <button type="button" class="layui-btn" id="uploadPic3">上传图片</button>
                                    </div>
                                </div>
                            </div>
                        </div>


                    </div>
                </div>





                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="button" class="layui-btn" lay-submit="" lay-filter="sub">保存当前修改</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>


        </div>
            </form>

    </div>



    <!--底部-->
    <i th:replace="~{common :: footer}"></i>
</div>

    <!--底部-->
    <i th:replace="~{common :: footer}"></i>
</div>
<script th:src="@{/layui/layui.js}"></script>
<script th:inline="none">
    //JavaScript代码区域
    layui.use(['element','form','upload','layer','laydate'], function() {
        var element = layui.element;
        var form = layui.form;
        var upload = layui.upload;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var $ = layui.$;

        $("#img1").attr("src",$("#headPortrait")[0].innerText)

        //图片上传
        var uploadInst = upload.render({
            elem: '#uploadPic1'
            ,url: baseUrl+'upload/pic'
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#showPic1').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code != 0){
                    return layer.msg('上传失败');
                }else {
                    $("#picPath1").val(res.data.src)
                }
                //上传成功
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#uploadText1');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });



//图片上传
        var uploadInst = upload.render({
            elem: '#uploadPic2'
            ,url: baseUrl+'upload/pic'
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#showPic2').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code != 0){
                    return layer.msg('上传失败');
                }else {
                    $("#picPath2").val(res.data.src)
                }
                //上传成功
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#uploadText2');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });



//图片上传
        var uploadInst = upload.render({
            elem: '#uploadPic3'
            ,url: baseUrl+'upload/pic'
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#showPic3').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code != 0){
                    return layer.msg('上传失败');
                }else {
                    $("#picPath3").val(res.data.src)
                }
                //上传成功
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#uploadText3');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });




        //提交
        form.on('submit(sub)', function(data){

            //发送ajax请求  编辑APP信息
            $.ajax({
                url:baseUrl+"merchants/information/edit",
                data:data.field,
                type:"post",
                dataType:"json",
                success:function (result) {
                    if (result.code==0){

                    }else {
                        layer.open({
                            title: '编辑菜品分类信息'
                            ,content: result.msg
                        });
                    }
                },
                error:function () {
                    layer.msg("服务器原地爆炸,请联系管理员!!!");
                }
            })
            // return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。

        });





    });

</script>

</body>
</html>



